package com.emit.view;

import lombok.Data;

/**
 * 说明：统一返回结果类
 * @author zhangchao
 */
@Data
public class ResultView<T> {
    /**
     * request success or not, 0 is success 1 is error
     */
    private Integer status;
    /**
     * error code
     */
    private String code="200";
    /**
     * Error message
     */
    private String msg;
    /**
     * Returned data
     */
    private T data;

    public ResultView() {
        this.status = 0;
    }
    public void setData(T data){
        this.data=data;
        this.code="200";
    }

    public ResultView(String code, String msg) {
        this.status = 1;
        this.code=code;
        this.msg = msg;
    }

    public ResultView(T data) {
        this.status = 0;
        this.data = data;
    }

    public ResultView(String code) {
        this.code = code;
    }



}
